﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TheatreManagementSystem
{
    public class Hall:IPrintable
    {

        public string Name { get; set; }
        public int Rows { get; set;}
        public int Cols { get; set; }
        public char[,] HallView{get; set;}

        public Hall(string name, char[,] hallView)
        { 
            this.Name = name;
            this.HallView = hallView;  
        }
        public string PrepareForPrint()
        {
            int line = HallView.GetLength(1);
            if (line>this.Name.Length)
            {
                int remainder = line - this.Name.Length;
                if (remainder%2==0)
                {
                    Console.WriteLine(new string(' ', remainder / 2) + this.Name + new string(' ', remainder / 2));
                }
                else
                {
                    Console.WriteLine(new string(' ', remainder / 2) + this.Name + new string(' ', remainder / 2+1));
                }
                
            }
            else
            {
                Console.WriteLine(this.Name);
            }
            StringBuilder hall = new StringBuilder();
            
            for (int i = 0; i < this.HallView.GetLength(0); i++)
            {
                for (int j = 0; j < this.HallView.GetLength(1); j++)
                {
                    hall.Append(HallView[i, j]);
                }
                hall.AppendLine();
            }
            return hall.ToString();
        }
    }
}
